<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<title>文本编辑</title>
		
		<link rel="stylesheet" href="default/default.css" />
		<link rel="stylesheet" href="default/prettify.css" />	
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script type="text/javascript"  src="default/kindeditor-all.js"></script>
		<script type="text/javascript"  src="default/zh-CN.js"></script>
		<script type="text/javascript"  src="default/prettify.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<script src="js/config.js"></script>
		<script src="js/remstyle.js"></script>
		
		
		
		
		
		
	</head>
	<style>
		.save_text {
			width: 100%;
			height: 1rem;
			text-align: center;
			line-height: 1rem;
			background: #1f8ff3;
			color: #fff;
			font-size: 0.28rem;
			border: none;
			position: fixed;
			bottom: 0;
			left: 0;
		}
	</style>

	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<form name="example" style="margin-bottom: 0;">
			<textarea id="content1" name="content1" cols="100" rows="8" style="width:100%;height:450px;visibility:hidden;border: 1px solid black;"></textarea>
			<br />

		</form>

		</div>
		<input class="save_text" type="button" onclick="getText()" value="提交内容" />
	</body>
	
	<script>
		
		function loadData() {
			$.ajax({
				type: "get",
				url: v_url + "/wechat/singlepage/getContent",
				data: {
					id: v_param,
					c_user_id:c_user_id
				},
				async: true,
				success: function(res) {

					var new_content = res.data;
					console.log(new_content.content)
					editor.html(new_content.content);
					//$("#content1").text(new_content.content);
				}
			});
		}
		var editor;　　 //全局变量
			KindEditor.ready(function(K) {
				editor = K.create('textarea[name="content1"]', {
					allowImageUpload: false,
					afterCreate: function() {
						loadData();
					},
					afterChange: function() {

					},
					afteBlur: function() {

					},
					items: [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 　　　　'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 　　　　'insertorderedlist', 'insertunorderedlist'
					]
				});
				//editor.html()='999'
			});

			function getText() {
				var aaaa = window.location.href;
				var bbbb = aaaa.substring(aaaa.indexOf('addToTo=') + 8,aaaa.length);
				var text = editor.html();　
				console.log(text);　　　　　　　　　　　　 //获取textarea文本域中的文本
				$.ajax({
					type: "get",
					url: v_url + "/wechat/singlepage/saveContent",
					data: {
						id: v_param,
						content: text,
						c_user_id:c_user_id
					},
					async: true,
					success: function(res) {
						if(res.code == 200) {
							layer.msg("保存成功", function() {
								window.location.href = bbbb;
							})
						} else {
							layer.msg("保存失败")
						}

					}
				});　　　　　　　　　　　
			}
		//		var template = document.getElementsByName('template')
	</script>

</html>